import { defineStore } from "pinia";
import piniaPersistConfig from "@/stores/helper/persist";
interface UserInfo {
  avatar: string;
  email: string;
  gender: string;
  nickName: string;
}
export const useInfoStore = defineStore({
  id: "Admin-info",
  state: (): { userInfo: UserInfo } => ({
    userInfo: {
      avatar: "",
      email: "",
      gender: "",
      nickName: ""
    }
  }),
  actions: {
    setInfo(userInfo: UserInfo) {
      this.userInfo = userInfo;
    },
    clearInfo() {
      this.userInfo = {
        avatar: "",
        email: "",
        gender: "",
        nickName: ""
      };
    }
  },
  persist: piniaPersistConfig("Admin-info")
});
